import { getAllSpuListApi } from "./../spu";
import type { UploadUserFile } from "element-plus";
// [
//     {
//       "id": 3455,
//       "spuName": "131",
//       "description": "131",
//       "category3Id": 61,
//       "tmId": 14355,
//       "spuSaleAttrList": null,
//       "spuImageList": null
//     },

//   ],
//   "total": 11,
//   "size": 3,
//   "current": 1,
//   "searchCount": true,
//   "pages": 4
// }

export interface GetSpuListParams {
  page: number;
  limit: number;
  category3Id: number;
}
export interface SpuItem {
  id: number;
  spuName: string;
  description: string;
  category3Id: number;
  tmId: number;
}
export type SpuList = SpuItem[];

export interface GetSpuListApiResponse {
  records: SpuList;
  total: number;
}

export interface getAllSpuItem {
  id: number;
  name: string;
}
export type getAllSpuList = getAllSpuItem[];

export interface SpuImageItem {
  id?: number;
  imgName: string;
  imgUrl: string;
}

export type SpuImageList = SpuImageItem[];

export interface SpuSaleAttrValueItem {
  baseSaleAttrId: number;
  id?: number;
  saleAttrValueName: string;
}

export type SpuSaleAttrValueList = SpuSaleAttrValueItem[];
export interface SpuSaleAttrItem {
  baseSaleAttrId: number;
  id?: number;
  saleAttrName: string;
  spuSaleAttrValueList: SpuSaleAttrValueList;
}

export type SpuSaleAttrList  = SpuSaleAttrItem[];
export interface SaveOrUpdateSpuApiParams {
  category3Id: number;
  id?: number;
  spuName: string;
  tmId: number;
  description: string;
  spuImageList: SpuImageList;
  spuSaleAttrList: SpuSaleAttrList;
}

export interface SaveSpuSaleAttrItem extends SpuSaleAttrItem {
  isEdit: boolean;
}

export type SaveSpuSaleAttrList = SaveSpuSaleAttrItem[];

export interface SpuFormData
  extends Pick<SaveOrUpdateSpuApiParams, "id" | "spuName" | "description"> {
  tmId: undefined | number;
  spuImageList: UploadUserFile[];
  spuSaleAttrList: SaveSpuSaleAttrList;
}


